﻿<Window x:Class="SABnzbdNET.Views.SettingsView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:sab="clr-namespace:SABnzbdNET.CustomControls"
        Title="Settings" Height="420" Width="425" Icon="pack://application:,,,/Graphics/SABnzbd.ico" ShowInTaskbar="False" WindowState="Normal" ResizeMode="NoResize" WindowStartupLocation="CenterOwner">
    <Grid Margin="10">
    	<Grid.Resources>
		    <DrawingImage x:Key="IconInfo">
		        <DrawingImage.Drawing>
		            <ImageDrawing Rect="0,0,24,24" ImageSource="/SABnzbdNET;component/Graphics/Toolbar/Info.ico" />
		        </DrawingImage.Drawing>
		    </DrawingImage>
		</Grid.Resources>
        <GroupBox HorizontalAlignment="Stretch" Height="85" VerticalAlignment="Top" Header="Server settings" >
            <Grid>
                <Label Height="25" Margin="0,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="100">Server address</Label>
                <TextBox Height="25" Margin="100,0,50,0" VerticalAlignment="Top" Text="{Binding Source={StaticResource Settings}, Path=Default.ServerPath}" />
                <Image Name="imgServerPathInfo" Height="24" Width="24" Stretch="Uniform" Margin="0,0,20,0" VerticalAlignment="Top" HorizontalAlignment="Right" ToolTip="Url of the server. E.g. http://localhost:8080/sabnzbd" Source="{StaticResource IconInfo}"></Image>
                <Label Height="25" Margin="0,30,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="100">Refresh interval</Label>
                <TextBox Height="25" Margin="100,30,0,0" VerticalAlignment="Top" Text="{Binding Source={StaticResource Settings}, Path=Default.TimerInterval}" HorizontalAlignment="Left" Width="30" MaxLength="3"  />
                <Label Height="25" Margin="135,30,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="100">minute(s)</Label>
            </Grid>
        </GroupBox>
        <GroupBox HorizontalAlignment="Stretch" Height="115" VerticalAlignment="Top" Header="Login information" Margin="0,95,0,0">
            <Grid>
                <Label Height="25" Margin="0,0,0,0" VerticalAlignment="top" HorizontalAlignment="Left" Width="100">Username</Label>
                <TextBox Height="25" Margin="100,0,200,0" VerticalAlignment="top" Text="{Binding Source={StaticResource Settings}, Path=Default.ServerUsername}" />
                <Label Height="25" Margin="0,30,0,0" VerticalAlignment="top" HorizontalAlignment="Left" Width="100">Password</Label>
                <sab:BindablePasswordBox Height="25" Margin="100,30,200,0" VerticalAlignment="top" Password="{Binding Path=Password}" />
                <Label Height="25" Margin="0,60,10,0" VerticalAlignment="top">API key</Label>
                <TextBox Height="25" Margin="100,60,50,0" VerticalAlignment="top" Text="{Binding Source={StaticResource Settings}, Path=Default.ServerAPIKey}" />
                <Image Height="24" Width="24" Stretch="Uniform" Margin="0,60,20,0" VerticalAlignment="Top" HorizontalAlignment="Right" ToolTip="API key found in the generel settings. SABnzd v0.4.9+ only." Source="{StaticResource IconInfo}"></Image>
            </Grid>
        </GroupBox>
    	<GroupBox HorizontalAlignment="Stretch" Height="110" VerticalAlignment="Top" Header="Misc" Margin="0,220,0,0">
            <Grid>
    			<CheckBox IsChecked="{Binding Source={StaticResource Settings}, Path=Default.MinimizeToTray}" Content="Minimize to tray" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="5,5,0,0"></CheckBox>
                <CheckBox IsChecked="{Binding Source={StaticResource Settings}, Path=Default.ShowTrayIcon}" Content="Always show tray icon" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="5,25,0,0"></CheckBox>
                <CheckBox Content="Start minimized" IsChecked="{Binding Source={StaticResource Settings}, Path=Default.StartMinimized}" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="5,45,0,0"></CheckBox>
                <CheckBox Content="Run SABnzbdNET at Windows startup" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="5,65,0,0" IsChecked="{Binding Path=AutoStartUp}"></CheckBox>
            </Grid>
        </GroupBox>
        <Button Height="25" HorizontalAlignment="Right" Margin="0,0,85,0" VerticalAlignment="Bottom" Width="75" Command="{Binding Path=SaveCommand}">OK</Button>
        <Button Height="25" HorizontalAlignment="Right" Margin="0,0,0,0" VerticalAlignment="Bottom" Width="75" Command="{Binding Path=CloseWindowCommand}">Cancel</Button>
    </Grid>
</Window>
